package com.sunmouse.toolkit.fragment.web;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.widget.ImageView;

import com.sunmouse.toollib.widget.SimpleWebView;
import com.squareup.picasso.Picasso;
import com.sunmouse.toolkit.R;
import com.sunmouse.toolkit.fragment.BaseFragment;
import com.sunmouse.toolkit.util.HttpUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * A simple {@link Fragment} subclass.
 */
public class TestFragment extends BaseFragment {


    @BindView(R.id.m_web)
    SimpleWebView mWeb;
    Unbinder unbinder;
    @BindView(R.id.face_iv)
    ImageView faceIv;

    public TestFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_test, container, false);
        unbinder = ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void init() {
        this.mWeb.getSettings().setPluginState(WebSettings.PluginState.ON);
        this.mWeb.loadUrl(HttpUtil.LOCAL_ASSET + "swf/3do.swf");
        Picasso .with(getActivity())
                .load("http://pinyin.cn/e19971")
                .resize(100, 100)
                .into(faceIv);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
